
function delText(id) {
	var dom=$('#text'+id);
	//console.log(dom.children().eq());
	if (dom.attr('data-text') == '删除段落') {
		dom.css('background', '#39ab67');
		dom.parent().css('color', '#cccccc');

		dom.children().eq(0).text('还原段落');
		dom.attr('data-text','还原段落');
		dom.children().eq(2).text('');
	} else {
		dom.css('background', '#f30');
		dom.parent().css('color', 'black');

		dom.children().eq(0).text('删除段落');
		dom.attr('data-text','删除段落');
		var text = dom.children().eq(1).text();
		dom.children().eq(2).text(text);
	}
}
function delImg(id) {
	var dom=$('#img'+id);
	//console.log(dom.children());
	if (dom.attr('data-text') == '删除图片') {
		dom.css('background', '#39ab67');
		dom.siblings().eq(0).attr('src',
			'https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=3231897502,2872604692&fm=58&bpow=400&bpoh=256'
		);

		dom.children().eq(0).text('还原图片');
		dom.attr('data-text','还原图片');
		dom.children().eq(2).text('');

	} else {
		dom.css('background', '#f30');
		var text1 = dom.children().eq(1).text();
		dom.siblings().eq(0).attr('src', JSON.parse(text1).textContent);

		dom.children().eq(0).text('删除图片');
		dom.attr('data-text','删除图片');
		var text = dom.children().eq(1).text();
		dom.children().eq(2).text(text);

	}
}
function delVideo(id) {
	var dom=$('#video'+id);
	var text = dom.attr('data-text');
	if (dom.attr('data-text') == '删除视频') {
		dom.css('background', '#39ab67');
		dom.parent().append(' <div class="cv-video-none"></div>');

		dom.children().eq(0).text('还原视频');
		dom.attr('data-text','还原视频');
		dom.children().eq(2).text('');

	} else {
		dom.css('background', '#f30');
		$(".cv-video-none").remove();

		dom.children().eq(0).text('删除视频');
		dom.attr('data-text','删除视频');
		var text = dom.children().eq(1).text();
		dom.children().eq(2).text(text);

	}
}
function commit() {
	var wxArticleUrl = $("#text").val();
	var type="";
	 if(wxArticleUrl=="" || wxArticleUrl==null){
		alert("请输入文章链接");
		return;
	}else if($("#articleSource").val()==""){
		 alert("请选择要查询的文章类型");
		 return;
	 }else if($("#articleSource").val()=="超V文章"){
		type=1;
	}else if($("#articleSource").val()=="普通文章"){
		type=0;
	}
	var reg = RegExp("https://mp.weixin.qq.com");
	// if (!reg.test(wxArticleUrl)) {
	// 	alert("请输入微信原生链接");
	// 	return;
	// }
	console.log(type)
	if(type==1){
		$.ajax({
			type: "POST",
			contentType: "application/json;charset=UTF-8",
			url: baseURL + "sys/barticleinfo/commit1",
			data: JSON.stringify(wxArticleUrl),
			dataType: "JSON",
			async:false,
			success: function (r) {
				if (r.code == 0) {
					vm.bArticleInfo = r.content;
					vm.bArticleInfo.article_title=r.content.title;
					console.log(vm.bArticleInfo.article_title)
					vm.bArticleInfo.article_content = r.family;
					var a =r.family;
					vm.bArticleInfo.id=null;
					$("#content").html(a);
					var img = document.getElementsByTagName('img');
					for(var i = 0;i<img.length;i++){
						img[i].style.width= '100%'
						img[i].parentNode.style=" position:relative; text-align:center;display: block;"
						var span=document.createElement("span"); //创建元素节点
						span.style = 'position:absolute;    left: 0;    bottom: 0;    right: 0;    top: 0;    z-index: 0;    background-color: rgba(0,0,0,0);'
						img[i].parentNode.appendChild(span); // 插入节点
						console.log(img[i].parentNode.children);
					}
					var iframe = document.getElementsByTagName('iframe');
					for(var i=0;i<iframe.length;i++){
						iframe[i].parentNode.style=" position:relative; text-align:center;display: block;"
						var span=document.createElement("span"); //创建元素节点
						span.style = 'position:absolute;    left: 0;    bottom: 0;    right: 0;    top: 0;    z-index: 0;    background-color: rgba(0,0,0,0);'
						iframe[i].parentNode.appendChild(span); // 插入节点
						console.log(iframe[i].parentNode.children);
					}
					var  mpvoice  =  document.getElementsByTagName('mpvoice');
					if  (mpvoice.length  !==  0)  {
						for  (var  i  =  0;  i  <  mpvoice.length;  i++)  {

							if(mpvoice[i].dataset.name){
								mpvoice[i].parentNode.innerHTML  +=  '<div  class="myvoice"  data-myname="myvoice"><div  clsass="mynamevoice"><div  class="MyAudioContent  article-content  rich_media_content  ">'
									+  '<audio  id="js-audio'+i+'"  data-source="https://res.wx.qq.com/voice/getvoice?mediaid='  +  mpvoice[i].dataset.voice_encode_fileid  +  '"  data-name="'  +  mpvoice[i].dataset.name  +  '">'
									+  '<source  src="https://res.wx.qq.com/voice/getvoice?mediaid='  +  mpvoice[i].dataset.voice_encode_fileid  +  '"  type="audio/mpeg">'
									+  '<source  src="https://res.wx.qq.com/voice/getvoice?mediaid='  +  mpvoice[i].dataset.voice_encode_fileid  +  '"  type="auido/mp3">'
									+  '</audio>'
									+  '</div>'
									+  '<div  id="js-audio-section'+i+'"  class="audio-section"  style="display:  block;"  data-auto="true">'
									+  '<div  class="audio-text">'
									+  '  <p  id="js-audio-name'+i+'"  class="audio-name">'  +  mpvoice[i].dataset.name  +  '</p>'
									+  '<p  id="js-audio-duration'+i+'"  class="audio-duration"></p>'
									+  '</div>'
									+  '<div  id="js-audio-button'+i+'"  class="audio-button"  >'
									+  '<svg  id="js-play'+i+'"  class="play"  width="41"  height="41"  xmlns="http://www.w3.org/2000/svg">'
									+  '<g  transform="translate(1  1)"  fill="none"  fill-rule="evenodd">'
									+  '<circle  stroke="#F56133"  stroke-width="2"  fill="#FFF"  cx="19.5"  cy="19.5"  r="19.5"/>'
									+  '<path  d="M11.664  27.724a53.53  53.53  0  0  1-.006-16.77  2.303  2.303  0  0  1  2.995-1.837c5.823  1.932  10.993  4.755  15.51  8.47a2.297  2.297  0  0  1  .035  3.515c-4.403  3.757-9.591  6.58-15.565  8.468a2.305  2.305  0  0  1-2.97-1.846"  fill="#F56133"/>'
									+  '</g>'
									+  '  </svg>'
									+  '<svg  id="js-pause'+i+'"  class="pause"  width="41"  height="41"  xmlns="http://www.w3.org/2000/svg">'
									+  '<g  transform="translate(1  1)"  fill="none"  fill-rule="evenodd">'
									+  '<circle  stroke="#F56133"  stroke-width="2"  fill="#FFF"  cx="19.5"  cy="19.5"  r="19.5"/>'
									+ ' <path d="M13.866 28.971c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C10.84 12.43 12.259 11 13.866 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57zm11.492 0c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C22.333 12.43 23.75 11 25.358 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57z" fill="#F56133"/>'
									+ '</g>'
									+ ' </svg>'
									+ '</div>'
									+ ' </div></div></div>'
							}
							// console.log(mpvoice[i])

							// setTimeout(() => {
							// audio.setup();
							var myid = document.getElementById('js-audio-section'+i+'');
							myid.parentNode.style.position = 'relative';

							var myhtml = document.createElement('div');
							myhtml.className='audiodiv';
							myid.parentNode.appendChild(myhtml);
							//}, 1000);

						}

					}
					var  qqmusic  =  document.getElementsByTagName('qqmusic');
					//alert(qqmusic.length)
					var  arry  =  [];
					for(var  i=0;i<qqmusic.length;i++){
						arry.push(qqmusic[i].getAttribute('mid'))
					}
					var  midurlinfo=[];
					var  data  =  {
						"req":{
							"module":"CDN.SrfCdnDispatchServer",
							"method":"GetCdnDispatch",
							"param":{
								"guid":"4680094450",
								"calltype":0,
								"userip":""
							}
						},
						"req_0":{
							"module":"vkey.GetVkeyServer",
							"method":"CgiGetVkey",
							"param":{
								"guid":"4680094450",
								"songmid":arry,
								"songtype":[0],
								"uin":"",
								"loginflag":1,
								"platform":"20"
							}
						},
						"comm":{
							"uin":'',
							"format":"json",
							"ct":24,
							"cv":0
						}
					}
					let  url  =  'https://u.y.qq.com/cgi-bin/musicu.fcg?-=getplaysongvkey5750188977044803&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0&data='+JSON.stringify(data);
					$.ajax({
						url:url,
						type:"get",
						dataType:'jsonp',
						//  jsonp:  "jsonpCallback",
						scriptCharset:  'GBK',//解决中文乱码
						success:  function(data){
							//最新音乐数据
							data.req_0.data.midurlinfo.forEach((item,index)  =>  {
								midurlinfo.push(item.purl)
							})
							if(qqmusic.length!==0){
								for(var  i=0;i<parseInt(qqmusic.length);i++){
									if(i  <=20){
										//  console.log(qqmusic[i])
										(function(i){
											console.log(i)
											//    setTimeout(function(){
											//  var  reg  =  /[\u3040-\u309F\u30A0-\u30FF]/;
											try  {
												var  music_name=  qqmusic[i].getAttribute('music_name');
											}  catch  (error)  {
												var  music_name=  '其他歌曲'
											}
											//  console.log('1111===='+JSON.stringify(qqmusic))
											//  if(mpvoice[i].dataset.name){
											qqmusic[i].parentNode.innerHTML  +='<div  class="myvoice"  data-myname=""><div  clsass="mynamevoice"><div  id="contentAudio"  class="MyAudioContent  article-content  rich_media_content  ">'
												+  '<audio  id="js-audio'+i+'"  data-source="http://dl.stream.qqmusic.qq.com/'+midurlinfo[i]+'"  data-name="'  +  music_name  +'">'
												+  '<source  src="http://dl.stream.qqmusic.qq.com/'+midurlinfo[i]+'"  type="audio/mp eg">'
												+'<source src="http://dl.stream.qqmusic.qq.com/'+midurlinfo[i]+'" type="auido/mp3">'
												+'</audio>'
												+'</div>'
												+'<div id="js-audio-section'+i+'" class="audio-section" style="display: block;" data-auto="true">'
												+'<div class="audio-text">'
												+ ' <p id="js-audio-name'+i+'" class="audio-name">' + music_name +'</p>'
												+'<p id="js-audio-duration'+i+'" class="audio-duration"></p>'
												+'</div>'
												+'<div id="js-audio-button'+i+'" class="audio-button" >'
												+'<svg id="js-play'+i+'" class="play" width="41" height="41" xmlns="http://www.w3.org/2000/svg">'
												+'<g transform="translate(1 1)" fill="none" fill-rule="evenodd">'
												+'<circle stroke="#F56133" stroke-width="2" fill="#FFF" cx="19.5" cy="19.5" r="19.5"/>'
												+'<path d="M11.664 27.724a53.53 53.53 0 0 1-.006-16.77 2.303 2.303 0 0 1 2.995-1.837c5.823 1.932 10.993 4.755 15.51 8.47a2.297 2.297 0 0 1 .035 3.515c-4.403 3.757-9.591 6.58-15.565 8.468a2.305 2.305 0 0 1-2.97-1.846" fill="#F56133"/>'
												+'</g>'
												+' </svg>'
												+'<svg id="js-pause'+i+'" class="pause" width="41" height="41" xmlns="http://www.w3.org/2000/svg">'
												+'<g transform="translate(1 1)" fill="none" fill-rule="evenodd">'
												+'<circle stroke="#F56133" stroke-width="2" fill="#FFF" cx="19.5" cy="19.5" r="19.5"/>'
												+' <path d="M13.866 28.971c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C10.84 12.43 12.259 11 13.866 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57zm11.492 0c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C22.333 12.43 23.75 11 25.358 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57z" fill="#F56133"/>'
												+'</g>'
												+' </svg>'
												+'</div>'
												+' </div></div></div>'
											//    },500)
											// audio.setup();
										})(i)

										// }
										// console.log(mpvoice[i])

										// setTimeout(() => {
										// audio.setup();
										var myid = document.getElementById('js-audio-section'+i+'');
										myid.parentNode.style.position = 'relative';

										var myhtml = document.createElement('div');
										myhtml.className='audiodiv';
										myid.parentNode.appendChild(myhtml);
										//  }, 1000);
									}
								}

							}
						},
						error:function (e) {
							console.log(e);
						}
					});
					// var obj = {
					// 	"data": {
					// 		"articleTitle": vm.bArticleInfo.article_title,
					// 		"articleInfo": a
					// 	}
					// };
					// domShow(obj);
				} else {
					alert(r.msg);
				}
			}
		});
	}else {
		$.ajax({
			type: "POST",
			contentType: "application/json;charset=UTF-8",
			url: baseURL + "sys/barticleinfo/commit",
			data: JSON.stringify(wxArticleUrl),
			dataType: "JSON",
			async: false,
			success: function (r) {
				if (r.code == 0) {
					vm.bArticleInfo = r.content;
					vm.bArticleInfo.article_content = r.family;
					var a = r.family;
					vm.bArticleInfo.id = null;
					$("#content").html(a);
					var html = document.getElementById('content').getElementsByTagName('*');
					for(var i=0;i<html.length;i++){
						html[i].style.overflow='';
					}
					var img = document.getElementsByTagName('img');
					for(var i = 0;i<img.length;i++){
						img[i].style.maxwidth= '100%'
						img[i].parentNode.style=" position:relative; text-align:center;display: block;"
						var span=document.createElement("span"); //创建元素节点
						span.style = 'position:absolute;    left: 0;    bottom: 0;    right: 0;    top: 0;    z-index: 0;    background-color: rgba(0,0,0,0);'
						img[i].parentNode.appendChild(span); // 插入节点
						span.className="imgNew";
						console.log(img[i].parentNode.children);
					}
					var iframe = document.getElementsByTagName('iframe');
					for(var i=0;i<iframe.length;i++){
						iframe[i].parentNode.style=" position:relative; text-align:center;display: block;"
						var span=document.createElement("span"); //创建元素节点
						span.style = 'position:absolute;    left: 0;    bottom: 0;    right: 0;    top: 0;    z-index: 0;    background-color: rgba(0,0,0,0);'
						iframe[i].parentNode.appendChild(span); // 插入节点
						span.className="iframeNew";
						console.log(iframe[i].parentNode.children);
					}
					var  mpvoice  =  document.getElementsByTagName('mpvoice');
					if  (mpvoice.length  !==  0)  {
						for  (var  i  =  0;  i  <  mpvoice.length;  i++)  {

							if(mpvoice[i].dataset.name){
								mpvoice[i].parentNode.innerHTML  +=  '<div  class="myvoice"  data-myname="myvoice"><div  clsass="mynamevoice"><div  class="MyAudioContent  article-content  rich_media_content  ">'
									+  '<audio  id="js-audio'+i+'"  data-source="https://res.wx.qq.com/voice/getvoice?mediaid='  +  mpvoice[i].dataset.voice_encode_fileid  +  '"  data-name="'  +  mpvoice[i].dataset.name  +  '">'
									+  '<source  src="https://res.wx.qq.com/voice/getvoice?mediaid='  +  mpvoice[i].dataset.voice_encode_fileid  +  '"  type="audio/mpeg">'
									+  '<source  src="https://res.wx.qq.com/voice/getvoice?mediaid='  +  mpvoice[i].dataset.voice_encode_fileid  +  '"  type="auido/mp3">'
									+  '</audio>'
									+  '</div>'
									+  '<div  id="js-audio-section'+i+'"  class="audio-section"  style="display:  block;"  data-auto="true">'
									+  '<div  class="audio-text">'
									+  '  <p  id="js-audio-name'+i+'"  class="audio-name">'  +  mpvoice[i].dataset.name  +  '</p>'
									+  '<p  id="js-audio-duration'+i+'"  class="audio-duration"></p>'
									+  '</div>'
									+  '<div  id="js-audio-button'+i+'"  class="audio-button"  >'
									+  '<svg  id="js-play'+i+'"  class="play"  width="41"  height="41"  xmlns="http://www.w3.org/2000/svg">'
									+  '<g  transform="translate(1  1)"  fill="none"  fill-rule="evenodd">'
									+  '<circle  stroke="#F56133"  stroke-width="2"  fill="#FFF"  cx="19.5"  cy="19.5"  r="19.5"/>'
									+  '<path  d="M11.664  27.724a53.53  53.53  0  0  1-.006-16.77  2.303  2.303  0  0  1  2.995-1.837c5.823  1.932  10.993  4.755  15.51  8.47a2.297  2.297  0  0  1  .035  3.515c-4.403  3.757-9.591  6.58-15.565  8.468a2.305  2.305  0  0  1-2.97-1.846"  fill="#F56133"/>'
									+  '</g>'
									+  '  </svg>'
									+  '<svg  id="js-pause'+i+'"  class="pause"  width="41"  height="41"  xmlns="http://www.w3.org/2000/svg">'
									+  '<g  transform="translate(1  1)"  fill="none"  fill-rule="evenodd">'
									+  '<circle  stroke="#F56133"  stroke-width="2"  fill="#FFF"  cx="19.5"  cy="19.5"  r="19.5"/>'
									+ ' <path d="M13.866 28.971c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C10.84 12.43 12.259 11 13.866 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57zm11.492 0c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C22.333 12.43 23.75 11 25.358 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57z" fill="#F56133"/>'
									+ '</g>'
									+ ' </svg>'
									+ '</div>'
									+ ' </div></div></div>'
							}
							// console.log(mpvoice[i])

							// setTimeout(() => {
							// audio.setup();
							var myid = document.getElementById('js-audio-section'+i+'');
							myid.parentNode.style.position = 'relative';

							var myhtml = document.createElement('div');
							myhtml.className='audiodiv';
							myid.parentNode.appendChild(myhtml);
							//}, 1000);

						}

					}
					var  qqmusic  =  document.getElementsByTagName('qqmusic');
					//alert(qqmusic.length)
					var  arry  =  [];
					for(var  i=0;i<qqmusic.length;i++){
						arry.push(qqmusic[i].getAttribute('mid'))
					}
					var  midurlinfo=[];
					var  data  =  {
						"req":{
							"module":"CDN.SrfCdnDispatchServer",
							"method":"GetCdnDispatch",
							"param":{
								"guid":"4680094450",
								"calltype":0,
								"userip":""
							}
						},
						"req_0":{
							"module":"vkey.GetVkeyServer",
							"method":"CgiGetVkey",
							"param":{
								"guid":"4680094450",
								"songmid":arry,
								"songtype":[0],
								"uin":"",
								"loginflag":1,
								"platform":"20"
							}
						},
						"comm":{
							"uin":'',
							"format":"json",
							"ct":24,
							"cv":0
						}
					}
					let  url  =  'https://u.y.qq.com/cgi-bin/musicu.fcg?-=getplaysongvkey5750188977044803&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0&data='+JSON.stringify(data);
					$.ajax({
						url:url,
						type:"get",
						dataType:'jsonp',
						//  jsonp:  "jsonpCallback",
						scriptCharset:  'GBK',//解决中文乱码
						success:  function(data){
							//最新音乐数据
							data.req_0.data.midurlinfo.forEach((item,index)  =>  {
								midurlinfo.push(item.purl)
							})
							if(qqmusic.length!==0){
								for(var  i=0;i<parseInt(qqmusic.length);i++){
									if(i  <=20){
										//  console.log(qqmusic[i])
										(function(i){
											console.log(i)
											//    setTimeout(function(){
											//  var  reg  =  /[\u3040-\u309F\u30A0-\u30FF]/;
											try  {
												var  music_name=  qqmusic[i].getAttribute('music_name');
											}  catch  (error)  {
												var  music_name=  '其他歌曲'
											}
											//  console.log('1111===='+JSON.stringify(qqmusic))
											//  if(mpvoice[i].dataset.name){
											qqmusic[i].parentNode.innerHTML  +='<div  class="myvoice"  data-myname=""><div  clsass="mynamevoice"><div  id="contentAudio"  class="MyAudioContent  article-content  rich_media_content  ">'
												+  '<audio  id="js-audio'+i+'"  data-source="http://dl.stream.qqmusic.qq.com/'+midurlinfo[i]+'"  data-name="'  +  music_name  +'">'
												+  '<source  src="http://dl.stream.qqmusic.qq.com/'+midurlinfo[i]+'"  type="audio/mp eg">'
												+'<source src="http://dl.stream.qqmusic.qq.com/'+midurlinfo[i]+'" type="auido/mp3">'
												+'</audio>'
												+'</div>'
												+'<div id="js-audio-section'+i+'" class="audio-section" style="display: block;" data-auto="true">'
												+'<div class="audio-text">'
												+ ' <p id="js-audio-name'+i+'" class="audio-name">' + music_name +'</p>'
												+'<p id="js-audio-duration'+i+'" class="audio-duration"></p>'
												+'</div>'
												+'<div id="js-audio-button'+i+'" class="audio-button" >'
												+'<svg id="js-play'+i+'" class="play" width="41" height="41" xmlns="http://www.w3.org/2000/svg">'
												+'<g transform="translate(1 1)" fill="none" fill-rule="evenodd">'
												+'<circle stroke="#F56133" stroke-width="2" fill="#FFF" cx="19.5" cy="19.5" r="19.5"/>'
												+'<path d="M11.664 27.724a53.53 53.53 0 0 1-.006-16.77 2.303 2.303 0 0 1 2.995-1.837c5.823 1.932 10.993 4.755 15.51 8.47a2.297 2.297 0 0 1 .035 3.515c-4.403 3.757-9.591 6.58-15.565 8.468a2.305 2.305 0 0 1-2.97-1.846" fill="#F56133"/>'
												+'</g>'
												+' </svg>'
												+'<svg id="js-pause'+i+'" class="pause" width="41" height="41" xmlns="http://www.w3.org/2000/svg">'
												+'<g transform="translate(1 1)" fill="none" fill-rule="evenodd">'
												+'<circle stroke="#F56133" stroke-width="2" fill="#FFF" cx="19.5" cy="19.5" r="19.5"/>'
												+' <path d="M13.866 28.971c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C10.84 12.43 12.259 11 13.866 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57zm11.492 0c-1.607 0-3.025-1.43-3.382-3.469a31.696 31.696 0 0 1 0-11.033C22.333 12.43 23.75 11 25.358 11c1.637 0 3.076 1.482 3.398 3.571a35.18 35.18 0 0 1 0 10.83c-.322 2.088-1.761 3.57-3.398 3.57z" fill="#F56133"/>'
												+'</g>'
												+' </svg>'
												+'</div>'
												+' </div></div></div>'
											//    },500)
											// audio.setup();
										})(i)

										// }
										// console.log(mpvoice[i])

										// setTimeout(() => {
										// audio.setup();
										var myid = document.getElementById('js-audio-section'+i+'');
										myid.parentNode.style.position = 'relative';

										var myhtml = document.createElement('div');
										myhtml.className='audiodiv';
										myid.parentNode.appendChild(myhtml);
										//  }, 1000);
									}
								}

							}
						},
						error:function (e) {
							console.log(e);
						}
					});
					// var obj = {
					// 	"data": {
					// 		"articleTitle": vm.bArticleInfo.article_title,
					// 		"articleInfo": a
					// 	}
					// };
					// domShow(obj);
				} else {
					alert(r.msg);
				}
			}
		});
	}
}
//修改标题
$('.ct-but').on('click', function () {
	if ($('.ct-textarea').attr("contenteditable") == 'false') {
		$(this).css('background', '#39ab67');
		$('.ct-textarea').attr("contenteditable", 'true');
	} else {
		$(this).css('background', '#f30');
		$('.ct-textarea').attr("contenteditable", 'false');
	}
});
//保存
function save(){
	var classname = document.getElementsByClassName('imgNew');
	for(var i = 0;i<classname.length;i++){
		classname[i].style = '';
	}
	var classname = document.getElementsByClassName('iframeNew');
	for(var i = 0;i<classname.length;i++){
		classname[i].style = '';
	}
	var myvoice = document.getElementsByClassName('myvoice')
	while (myvoice.length >0){
		//for(var i=0;i<myvoice.length;i++){
			console.log(i+">>>")
			myvoice[0].parentNode.removeChild(myvoice[0]);
		//}

	}
	var arr=$("#content").html();
    console.log("Content arr:"+arr);
	vm.bArticleInfo.articleTitle=vm.bArticleInfo.article_title;
	vm.bArticleInfo.articleContent=arr;
	vm.bArticleInfo.articleDesc=vm.bArticleInfo.article_desc;
	vm.bArticleInfo.articleImgUrl=vm.bArticleInfo.article_img_url;
	var wxArticleUrl = $("#text").val();
	if(vm.bArticleInfo.id==null || vm.bArticleInfo.id=="") {
		if (wxArticleUrl == "" || wxArticleUrl == null) {
			alert("请输入链接");
			return;
		}
		// else if ($('input[name="Fruit"]:checked').val() == null || $('input[name="Fruit"]:checked').val() == "") {
		// 	alert("请选择文章类型");
		// 	return;
		// }
		else if($("#brandNames").val()==""|| $("#brandNames").val()==null){
			alert("请选择品牌");
			return;
		}
	}
	if($("#brandNames").val()!=""&&$("#brandNames").val()!=null){
		vm.bArticleInfo.brandName=$("#brandNames").val();
	}
	vm.bArticleInfo.articleHotScore=$("#hot").val();
	if($("#hot").val()==""||$("#hot").val()==null){
		vm.bArticleInfo.articleHotScore=10000;
	}
	console.log(vm.bArticleInfo.articleHotScore);
	vm.bArticleInfo.articleTypeId=$('input[name="Fruit"]:checked').val();
	var url = vm.bArticleInfo.id == null ? "sys/barticleinfo/save" : "sys/barticleinfo/update";
	$.ajax({
		type: "POST",
		contentType: "application/json;charset=UTF-8",
		url: baseURL + url,
		data:JSON.stringify(vm.bArticleInfo),
		dataType: "JSON",
		success: function (r) {
			if(r.total>0){
				alert("该文章已存在，请重新添加");
				return;
			}else if(r.code!=0){
				alert(r.msg);
				return;
			}else{
				alert("操作成功",function () {
					window.location.reload();
				});
			}
		}
	})
}
$('.content-save').on('click', function () {
	var arr = [];
	$('.obj').each(function () {
		//console.log($(this).text());
		if ($(this).text()) {
			var obj =JSON.parse($(this).text());
			arr.push(obj);
		}


	});
	var classname = document.getElementsByClassName('imgNew');
	for(var i = 0;i<classname.length;i++){
		classname[i].style = '';
	}
	var classname = document.getElementsByClassName('iframeNew');
	for(var i = 0;i<classname.length;i++){
		classname[i].style = '';
	}
	var myvoice = document.getElementsByClassName('myvoice')
	if (myvoice.length >0){
		for(var i=0;i<myvoice.length;i++){
			myvoice[i].parentNode.removeChild(myvoice[i]);
		}

	}
	vm.bArticleInfo.articleContent=JSON.stringify(arr);
	vm.bArticleInfo.articleTitle=$('.ct-textarea').text();
	vm.bArticleInfo.articleDesc=vm.bArticleInfo.article_desc;
	vm.bArticleInfo.articleImgUrl=vm.bArticleInfo.article_img_url;
	var wxArticleUrl = $("#text").val();
	if(vm.bArticleInfo.id==null || vm.bArticleInfo.id=="") {
		if (wxArticleUrl == "" || wxArticleUrl == null) {
			alert("请输入链接");
			return;
		} else if ($('input[name="Fruit"]:checked').val() == null || $('input[name="Fruit"]:checked').val() == "") {
			alert("请选择文章类型");
			return;
		}
	}
	vm.bArticleInfo.articleTypeId=$('input[name="Fruit"]:checked').val();
	var url = vm.bArticleInfo.id == null ? "sys/barticleinfo/save" : "sys/barticleinfo/update";
	$.ajax({
		type: "POST",
		contentType: "application/json;charset=UTF-8",
		url: baseURL + url,
		data:JSON.stringify(vm.bArticleInfo),
		dataType: "JSON",
		success: function (r) {
			if(r.total>0){
				alert("该文章已存在，请重新添加");
				return;
			}else if(r.code!=0){
				alert(r.msg);
				return;
			}else{
				alert("操作成功",function () {
					window.location.reload();
				});
			}
		}
	})
	//console.log(arr);
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
			articleTypeName:null,
			articleTitle:null,
		},
		bArticleInfo : {
			article_content:[],
			article_desc:null,
			article_img_url:null
		},
		bBrandinfo:{},
		bbrandinfo:{},
		brandId:"",
		JsonContentEntity:{}
	},
	methods: {

		// commit: function () {
		// 	var wxArticleUrl = $("#text").val();
		// 	var reg = RegExp("https://mp.weixin.qq.com");
		// 	if (!reg.test(wxArticleUrl)) {
		// 		alert("请输入微信原生链接");
		// 		return;
		// 	}
		// 	$.ajax({
		// 		type: "POST",
		// 		contentType: "application/json;charset=UTF-8",
		// 		url: baseURL + "sys/barticleinfo/commit",
		// 		data: JSON.stringify(wxArticleUrl),
		// 		dataType: "JSON",
		// 		async:false,
		// 		success: function (r) {
		// 			if (r.code == 0) {
		// 				vm.bArticleInfo = r.content;
		// 				vm.bArticleInfo.article_content = r.family;
		// 				console.log(r.family);
		// 				var obj = {
		// 					"data": {
		// 						"articleTitle": vm.bArticleInfo.article_title,
		// 						"articleInfo": r.family
		// 					}
		// 				};
		// 				domShow(obj);
		//
		// 			} else {
		// 				alert("链接内容无法解析");
		// 			}
		// 		}
		// 	});
		// },
	},
	mounted:function () {
		//修改标题

	}
});
function domShow(obj) {
	// var url = location.search;
	// console.log(url);
	// if(url!=null && url!="") {
	// 	var articleId = url.split("=")[1];
	// 	console.log(articleId)
	// }
	$('.content-section').html('');
	$('.ct-textarea').text(obj.data.articleTitle);
	var data = obj.data.articleInfo;
	var text = '';
	var img = '';
	var video = '';
	for (var i = 0; i < data.length; i++) {
		var iframe="<xmp>"+JSON.stringify(data[i])+"</xmp>";
		// console.log(iframe);
		if (data[i].textType == 1) {
			if(data[i].textContent==null){
				continue;
			}
			// console.log(data[i].textContent);
			var textContent=data[i].textContent;
			if(textContent.indexOf('src')==-1){
				text = ' <div class="null15"></div>'
				if(data[i].textContent.indexOf('strong')==-1){
					text += '<div class="content-p"><div class="cp-textarea" contenteditable="false">' + data[i].textContent + '</div>';
				}else{
					var textDom= data[i].textContent.split('<strong>');
					//console.log(textDom);
					text += '<div class="content-p"><div class="cp-textarea" contenteditable="false">' +textDom[1]+ '</div>';
				}
				text += ' <div class="cp-but" id=text'+i+' onclick="delText('+i+')" data-text="删除段落"><span>删除段落</span>';
				text += '<i class="none">' + iframe + '</i>';
				text += '<span class="none obj">' + iframe + '</span>';
				text += '</div></div>';
				$('.content-section').append(text);
			}else {
				var srcArr = data[i].textContent.split('src="');
				var src0 = srcArr[1].split('">')[0];
				var src1 = src0.split('?')[1];
				var src = 'http://v.qq.com/txp/iframe/player.html?' + src1;

				video = ' <div class="null15"></div>';
				video += ' <div class="content-video"><div class="cv-video-dom"> <div class="cv-video">';
				video += '<iframe src=' + src +
					' class="iframepage" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>';
				video += '</div><div class="cv-but" id=video'+i+' onclick="delVideo('+i+')" data-text="删除视频"><span>删除视频</span>';
				video += '<i class="none">' + iframe + '</i>';
				video += '<span class="none obj">' + iframe + '</span>';
				video += '</div></div>';
				$('.content-section').append(video);
			}

		} else if (data[i].textType == 2) {
			img = '<div class="null15"></div>';
			img += '<div class="content-img">';
			img += '<img class="ci-img" src=' + data[i].textContent + ' />';
			img += '<div class="ci-del" id=img'+i+' onclick="delImg('+i+')" data-text="删除图片"><span>删除图片</span>';
			img += '<p class="none">' + JSON.stringify(data[i]) + '</p>'
			img += '<span class="none obj">' + JSON.stringify(data[i]) + '</span>';
			img += '</div></div>';
			$('.content-section').append(img);
		} else if (data[i].textType == 3) {
			//
			continue;
			var srcArr = data[i].textContent.split('src="');
			var src0 = srcArr[1].split('">')[0];
			var src1 = src0.split('?')[1];
			var src = 'http://v.qq.com/txp/iframe/player.html?' + src1;
			//console.log(src);
			video = ' <div class="null15"></div>';
			video += ' <div class="content-video"><div class="cv-video-dom"> <div class="cv-video">';
			video += '<iframe src=' + src +
				' class="iframepage" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>';
			video += '</div><div class="cv-but" id=video'+i+' onclick="delVideo('+i+')" data-text="删除视频"><span>删除视频</span>';
			video += '<i class="none">' + iframe + '</i>';
			video += '<span class="none obj">' + iframe + '</span>';
			video += '</div></div>';
			$('.content-section').append(video);
		}
	}

}
//
var obj1 = {
	"data": {
		"articleTitle": "车智汇教你如何把你的车变成智能互联网汽车？出行更安全更省钱省心",
		"articleInfo": [{
			"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
			"textType": 2
		}, {
			"textContent": "先看下爱车联网后的效果1.",
			"textType": 1
		}, {
			"textContent": "<iframe allowfullscreen=\"\" class=\"video_iframe\" data-ratio=\"1.7666666666666666\" data-vidtype=\"2\" data-w=\"848\" frameborder=\"0\" src=\"https://v.qq.com/iframe/preview.html?vid=i0745hd0yxk&amp;width=500&amp;height=375&amp;auto=0\"></iframe>",
			"textType": 3
		}, {
			"textContent": "先看下爱车联网后的效果2.",
			"textType": 1
		}, {
			"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
			"textType": 2
		}, {
			"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
			"textType": 2
		}, {
			"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
			"textType": 2
		}, {
			"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
			"textType": 2
		}, {
			"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
			"textType": 2
		},
			{
				"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
				"textType": 2
			}, {
				"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
				"textType": 2
			}, {
				"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
				"textType": 2
			}, {
				"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
				"textType": 2
			}, {
				"textContent": "https://mmbiz.qpic.cn/mmbiz_jpg/XwEUXDozLl3eqeGnyNWsyVCTWnlQ2hDuuia3X3FpRUDHkXr975MP23ibksvjPgQGPomzHvISL7DAznhp1TcRLxIA/640?wx_fmt=jpeg",
				"textType": 2
			},

		],

	},
};